<template>
  <tbody>
    <tr v-for="(item, index) in list" :key="item.name">
      <td><input type="checkbox" v-model="item.checked" /></td>
      <td>{{ item.name }}</td>
      <td>{{ item.price }}</td>
      <td>
        <button @click="item.num > 0 ? item.num-- : 0">-</button>{{ item.num
        }}<button @click="item.num++">+</button>
      </td>
      <td>{{ (item.price - 0) * (item.num - 0) }}</td>
      <td><button @click="rem(index)">删除</button></td>
    </tr>
  </tbody>
</template>

<script>
export default {
  props: ["list"],
  computed: {},

  methods: {
    rem(a) {
      this.list.splice(a, 1);
    },
  },
};
</script>

<style></style>
